package com.zb.config;

import cn.dev33.satoken.stp.StpInterface;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 自定义角色、权限加载接口实现类
 * @Author WEN
 * @Date 2023/7/12 0012
 **/
@Component
public class RoleAuthorInterfaceImpl implements StpInterface {
    @Override
    public List<String> getPermissionList(Object o, String s) {
        Long loginId = (Long) o;
        List<String> permiss = new ArrayList<>();
        permiss.add("*");
        return permiss;
    }

    @Override
    public List<String> getRoleList(Object o, String s) {
        Long loginId = (Long) o;
        // TODO 待根据账号ID查询账号所拥有的角色
        List<String> roles = new ArrayList<>();
        roles.add("admin");
        return roles;
    }
}
